#导入日志采集、发送邮件
import logging,yagmail,yaml,json

#日志采集方法
def log_set():
    logging.basicConfig(filename='log.txt',filemode='w+',level=logging.DEBUG,format='%(asctime)s -> %(levelname)s -> %(message)s')

#发送邮件方法
def send_mail(filepath):
    mail = yagmail.SMTP(user='2930885223@qq.com',password='lkeujdjexnsldfdg',host='smtp.qq.com')
    mail.send(to='2930885223@qq.com',subject='测试报告',contents='今日报告,请查看',attachments=filepath)


#封装yaml的方法
def data_yaml(filepath):
    with open(filepath,'r',encoding='utf8') as f:
        return yaml.safe_load(f)

#封装json的方法
def data_json(filepath):
    with open(filepath,'r',encoding='utf-8') as f:
        return json.load(f)